package day1.TraversalBinaryTree;

/**
 * @author pacai
 * @version 1.0
 */
public class SymmetricTree {
    public static class TreeNode{
         public int data;
         public TreeNode left;
         public TreeNode right;
    }

    public static boolean isMirrorTree(TreeNode h1,TreeNode h2){
        if(h1 == null ^ h2 == null) return false;
        if(h1 == null && h2 == null) return true;
        return h1.data == h2.data && isMirrorTree(h1.left, h2.right)
                && isMirrorTree(h2.left,h1.right);
    }

}
